<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWorkOrderMissionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('work_order_missions', function (Blueprint $table) {
            $table->id();
            $table->string('workOrderNo', 32)->default('')->comment('工单号');
            $table->unsignedSmallInteger('step')->default(0)->comment('任务阶段');
            $table->unsignedInteger('dealUid')->default(0)->comment('处理人id');
            $table->unsignedTinyInteger('missionStatus')->default(0)->comment('0未处理 1已处理');
            $table->unsignedInteger('completeTime')->default(0)->comment('完成时间');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0);
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '工单 - 任务流程记录';

            $table->index('workOrderNo', 'idx_workOrderNo');
            $table->index('dealUid', 'idx_dealUid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('work_order_missions');
    }
}
